Online-Academy
Look, Read, Understand, Apply

Data Base

Q and A

  1. What is a Database?
  2. A database is an organized collection of structured information or data stored electronically in a computer system, usually managed by a Database Management System (DBMS).

  3. What is a DBMS?
  4. DBMS (Database Management System) is software that allows users to define, create, maintain, manipulate, and control access to the database (e.g., MySQL, Oracle, PostgreSQL).

  5. What are the main functions of a DBMS?
    • Data storage and retrieval
    • Data manipulation
    • Security and authorization
    • Backup and recovery
    • Data integrity and consistency
  6. What are the types of DBMS?
    • Hierarchical DBMS
    • Network DBMS
    • Relational DBMS (RDBMS)
    • Object-oriented DBMS
  7. What is a relational database?
  8. A relational database stores data in tables (relations) consisting of rows and columns, with relationships between tables.

  9. What is a data model?
  10. A data model defines how data is structured, stored, and accessed. Examples: Hierarchical, Network, Relational, ER Model.

  11. What is the ER Model?
  12. Entity-Relationship (ER) Model represents data using entities (objects) and relationships between them.

  13. What is an entity?
  14. An entity is an object that exists (physical or abstract) and can be distinguished from others — e.g., Student, Employee.

  15. What is an attribute?
  16. An attribute is a property or characteristic of an entity — e.g., Name, RollNo, Address of student.

  17. What is the difference between logical and physical data independence?
    • Logical independence: Ability to change the logical schema without changing applications.
    • Physical independence: Ability to change physical storage without affecting the logical schema.
  18. What is a primary key?
  19. A unique identifier for each record in a table. It cannot contain NULL values.

  20. What is a foreign key?
  21. A field in one table that refers to the primary key of another table, establishing a relationship between them.

  22. What is a candidate key?
  23. A minimal set of attributes that can uniquely identify a record.

  24. What is a composite key?
  25. A key made up of two or more attributes that together uniquely identify a record.

  26. What is a unique key?
  27. A key that ensures all values in a column are unique but can contain a single NULL.

  28. What is a constraint?
  29. A rule applied to a column or table to enforce data integrity (e.g., NOT NULL, UNIQUE, CHECK, FOREIGN KEY).

  30. What does SQL stand for?
  31. Structured Query Language.

  32. What are the different types of SQL commands?
    • DDL (Data Definition Language): CREATE, ALTER, DROP
    • DML (Data Manipulation Language): INSERT, UPDATE, DELETE
    • DCL (Data Control Language): GRANT, REVOKE
    • TCL (Transaction Control Language): COMMIT, ROLLBACK, SAVEPOINT
  33. What is a view?
  34. A virtual table based on the result of a SQL query that does not store data physically.

  35. What is the difference between DELETE and TRUNCATE?
    • DELETE: Removes selected rows, can have WHERE clause, can be rolled back.
    • TRUNCATE: Removes all rows, cannot have WHERE, faster, cannot be rolled back.
  36. What is a stored procedure?
  37. A precompiled collection of SQL statements that can be executed repeatedly.

  38. What is a trigger?
  39. A set of instructions that automatically executes in response to certain database events (INSERT, UPDATE, DELETE).

  40. What is normalization?
  41. Process of organizing data to reduce redundancy and improve data integrity.

  42. What are anomalies in DBMS?
    • Insertion anomaly: Can't insert data without related information.
    • Deletion anomaly: Deleting one record removes essential information.
    • Update anomaly : Redundant data causes inconsistency during updates.
  43. What are the normal forms?
    • 1NF: Atomic columns
    • 2NF: No partial dependency
    • 3NF: No transitive dependency
    • BCNF: Every determinant is a candidate key
  44. What is denormalization?
  45. The process of combining normalized tables to improve read performance by reducing joins.

  46. What is a transaction?
  47. A logical unit of work that contains one or more SQL statements.

  48. What are ACID properties?
    • Atomicity: All or nothing
    • Consistency: Maintains valid state
    • Isolation: Concurrent transactions don't interfere each other
    • Durability: Changes persist after commit
  49. What is a deadlock?
  50. A situation where two or more transactions wait indefinitely for each other to release locks.

  51. What is a lock?
  52. A mechanism to control concurrent access to data.

  53. What are the types of locks?
    • Shared lock (read)
    • Exclusive lock (write)
  54. What is indexing?
  55. Indexing is a technique to speed up data retrieval by creating a data structure (index) based on columns.

  56. What is a clustered index?
  57. Clustered index stores actual data rows in the order of the index; one per table.

  58. What is a non-clustered index?
  59. Stores pointers to the data rows instead of actual data.

  60. What is a cursor?
  61. A database object used to retrieve and manipulate rows one by one.

  62. What is a schema?
  63. A logical structure that represents the organization of the entire database.

  64. What is data redundancy?
  65. Storing the same data in multiple places unnecessarily.

  66. What is data integrity?
  67. The accuracy, consistency, and reliability of data throughout its lifecycle.

  68. What is referential integrity?
  69. It is a constrain that ensures foreign key values always refer to existing records in the referenced table.

  70. What is a distributed database?
  71. A database distributed across different physical locations but managed as a single database.

  72. What is a NoSQL database?
  73. A non-relational database designed for unstructured or semi-structured data (e.g., MongoDB, Cassandra).

  74. What are the types of NoSQL databases?
    • Document-based
    • Key-value
    • Column-based
    • Graph-based
  75. What is data warehousing?
  76. A system used for analysis and reporting of large volumes of historical data.

  77. What is OLTP vs OLAP?
    • OLTP: Online Transaction Processing (for daily operations)
    • OLAP: Online Analytical Processing (for analysis and reporting)
  78. What is database security?
  79. Protecting data from unauthorized access, corruption, or theft.

  80. What is data backup?
  81. Creating a copy of database data to restore in case of failure or loss.

  82. What is data recovery?
  83. Restoring data from backup or transaction logs after a failure.

  84. What is user privilege in DBMS?
  85. The rights given to users to perform certain actions (SELECT, INSERT, DELETE, etc.).

  86. What is a relationship in DBMS?
  87. An association between two or more tables using primary and foreign keys.

  88. What is a subquery?
  89. A query nested inside another SQL query.